#ifndef __MATH_H__
#define __MATH_H__

#include <math.h>

namespace Math
{

const float PI                    = 3.14159265f;
const float PI_OVER_2             = Math::PI / 2.0f;
const float PI_OVER_4             = Math::PI / 4.0f;
const float PI_OVER_180           = Math::PI / 180.0f;
const float TWO_PI                = Math::PI * 2.0f;
const float ONE_OVER_PI           = 1.0f / Math::PI;
const float EPSILON               = 1.0e-4f;
#ifdef INFINITY
#undef INFINITY
#endif
const float INFINITY              = -logf(0.0f);
const float MINUSINFINITY         = -INFINITY;
#ifdef NAN
#undef NAN
#endif
const float NAN                   = sqrtf(-1.0f);


// Absolute value
template <class T>
inline T Abs(T x);

// Rounds a floating point value to the nearest int
inline int RoundToInt(float f);


// Rounds a floating point value down to an int
inline int RoundDownToInt(float x);


// Rounds a floating point value up to an int
inline int RoundUpToInt(float x);


// Rounds a floating point value down
inline float Floor(float x);

// Rounds a floating point value up
inline float Ceil(float x);

// Rounds a floating point value
inline float Round(float f);


// Calculates the sin of x
inline float Sin(float x);


// Calculates the cosine of x
inline float Cos(float x);

// Calculates the tangent of x
inline float Tan(float x);

// Calculates the arccosine of x
inline float Acos(float x);

// Calculates the arcsine of x
inline float Asin(float x);

// Calculates the arctan of x
inline float Atan(float x);

// Copys the sign from one value to another
template <class T>
inline T CopySign(T from, T to);

// Compares signs, returns true if equal
template <class T>
inline bool SignCompare(T a, T b);

// Returns the maximum of two values
template <class T>
inline T Max(T a, T b);

// Returns the minimum of two values
template <class T>
inline T Min(T a, T b);

// Clamps a value between a minimum and a maximum
template <class T>
inline T Clamp(T value, T min, T max);

// Converrs radians to degrees
inline float Degrees(float radians);

// Converst degrees to radians
inline float Radians(float degrees);

// Calculates the square root of a value
inline float Sqrt(float x);

// Calculates the square of a value
inline float Sqr(float x);

// Calculates the cube of a value
inline float Cube(float x);

// Return strue if a float is finite
inline bool IsFinite(float v);

// Return strue if x is a number
inline bool IsNumber(float x);
};

#include <Metgine/Core/Math.inl>
#endif
